<?php

namespace Chat\Model;


use Zend\Db\Adapter\Adapter;
use Zend\Db\TableGateway\AbstractTableGateway;
use Zend\Db\Sql\Select;
use Chat\Model\Entity\User as User;

class UserTable extends AbstractTableGateway
{
	
	protected $table = 'user';
	
	public function __construct(Adapter $adapter) {
		$this->adapter = $adapter;
	}
	
	public function getAllUsersButMe($myID){
		
		$stmt = null;
        $resultSet = null;
        $query = null;
        
        $query = "SELECT user_id, email FROM user WHERE user_id != $myID ORDER BY email";
      
        $stmt = $this->adapter->query($query);
        $resultSet = $stmt->execute();
		
			$entities = array();
			foreach ($resultSet as $row) {				
				$entities[$row['user_id']] = $row['email'];
			}
		
			return $entities;

		
	}
	
}